Skip to content

[3.8] bpo-38811: Check for presence of os.link method in pathlib (GH-17225)#17626

Merged
miss-islington merged 1 commit into
python:3.8from
miss-islington:backport-092435e-3.8
Dec 16, 2019
Merged

[3.8] bpo-38811: Check for presence of os.link method in pathlib (GH-17225)#17626
miss-islington merged 1 commit into
python:3.8from
miss-islington:backport-092435e-3.8

Conversation

@miss-islington

@miss-islington miss-islington commented Dec 16, 2019

Copy link
Copy Markdown
Contributor

Commit 6b5b013 ("bpo-26978: Implement pathlib.Path.link_to (Using
os.link) (GH-12990)") introduced a new link_to method in pathlib. However,
this makes pathlib crash when the 'os' module is missing a 'link' method.

Fix this by checking for the presence of the 'link' method on pathlib
module import, and if it's not present, turn it into a runtime error like
those emitted when there is no lchmod() or symlink().

Signed-off-by: Toke Høiland-Jørgensen toke@redhat.com
(cherry picked from commit 092435e)

Co-authored-by: Toke Høiland-Jørgensen toke@redhat.com

https://bugs.python.org/issue38811

…17225)

Commit 6b5b013 ("bpo-26978: Implement pathlib.Path.link_to (Using
os.link) (pythonGH-12990)") introduced a new link_to method in pathlib. However,
this makes pathlib crash when the 'os' module is missing a 'link' method.

Fix this by checking for the presence of the 'link' method on pathlib
module import, and if it's not present, turn it into a runtime error like
those emitted when there is no lchmod() or symlink().

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
(cherry picked from commit 092435e)

Co-authored-by: Toke Høiland-Jørgensen <toke@redhat.com>

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good bot.

@miss-islington

Copy link
Copy Markdown
Contributor Author

@tohojo and @vstinner: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 8d0f369 into python:3.8 Dec 16, 2019
@miss-islington miss-islington deleted the backport-092435e-3.8 branch December 16, 2019 12:42
@miss-islington

Copy link
Copy Markdown
Contributor Author

@tohojo and @vstinner: Status check is done, and it's a success ✅ .

1 similar comment
@miss-islington

Copy link
Copy Markdown
Contributor Author

@tohojo and @vstinner: Status check is done, and it's a success ✅ .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants